package com.web.kdl.dao.user;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.web.kdl.entity.user.UserInfo;
import com.web.kdl.pojo.Vo.UserVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zq
 * @date 2022/7/2 12:01
 */
@Mapper
@Repository
public interface UserDao  extends BaseMapper<UserInfo> {

    List<UserVo> getAllUser();

    @Insert("insert into user_info(username,password,role,email) values(#{username},#{password},#{role},#{email})")
    int insertUser(UserInfo user);

    @Select("select * from user_info where username=#{username}")
    UserInfo findByUsername(String username);

    int deleteByIds(@Param("ids") List<String> userIds);

    List<String> listAuthorityById(String userId);
}
